﻿using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

namespace Studio
{
	// Token: 0x020004A4 RID: 1188
	public class OIItemInfo : ObjectInfo
	{
		// Token: 0x06001DA4 RID: 7588 RVA: 0x000BC088 File Offset: 0x000BA288
		public OIItemInfo(int _no, int _key) : base(_key)
		{
			this.no = _no;
			this.child = new List<ObjectInfo>();
			this.color.SetDiffuseRGB(Color.white);
			this.color.specularIntensity = 0.4f;
			this.color.specularSharpness = 0.55f;
			this.color2.SetDiffuseRGB(Color.white);
			this.color2.specularSharpness = 0.55f;
			this.bones = new Dictionary<string, OIBoneInfo>();
			this.animeNormalizedTime = 0f;
		}

		// Token: 0x17000324 RID: 804
		// (get) Token: 0x06001DA5 RID: 7589 RVA: 0x000BC138 File Offset: 0x000BA338
		public override int kind
		{
			get
			{
				return 1;
			}
		}

		// Token: 0x17000325 RID: 805
		// (get) Token: 0x06001DA6 RID: 7590 RVA: 0x000BC13C File Offset: 0x000BA33C
		// (set) Token: 0x06001DA7 RID: 7591 RVA: 0x000BC144 File Offset: 0x000BA344
		public int no { get; private set; }

		// Token: 0x17000326 RID: 806
		// (get) Token: 0x06001DA8 RID: 7592 RVA: 0x000BC150 File Offset: 0x000BA350
		// (set) Token: 0x06001DA9 RID: 7593 RVA: 0x000BC158 File Offset: 0x000BA358
		public List<ObjectInfo> child { get; private set; }

		// Token: 0x06001DAA RID: 7594 RVA: 0x000BC164 File Offset: 0x000BA364
		public override void Save(BinaryWriter _writer, Version _version)
		{
			base.Save(_writer, _version);
			_writer.Write(this.no);
			_writer.Write(this.animeSpeed);
			_writer.Write(1);
			this.color.Save(_writer);
			this.color2.Save(_writer);
			_writer.Write(this.enableFK);
			_writer.Write(this.bones.Count);
			foreach (KeyValuePair<string, OIBoneInfo> keyValuePair in this.bones)
			{
				_writer.Write(keyValuePair.Key);
				keyValuePair.Value.Save(_writer, _version);
			}
			_writer.Write(this.animeNormalizedTime);
			int count = this.child.Count;
			_writer.Write(count);
			for (int i = 0; i < count; i++)
			{
				this.child[i].Save(_writer, _version);
			}
		}

		// Token: 0x06001DAB RID: 7595 RVA: 0x000BC274 File Offset: 0x000BA474
		public override void Load(BinaryReader _reader, Version _version, bool _import, bool _tree = true)
		{
			base.Load(_reader, _version, _import, true);
			this.no = _reader.ReadInt32();
			this.animeSpeed = _reader.ReadSingle();
			int version = _reader.ReadInt32();
			this.color.Load(_reader, version);
			this.color2.Load(_reader, version);
			this.enableFK = _reader.ReadBoolean();
			int num = _reader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				string key = _reader.ReadString();
				this.bones[key] = new OIBoneInfo(_import ? Studio.GetNewIndex() : -1);
				this.bones[key].Load(_reader, _version, _import, true);
			}
			this.animeNormalizedTime = _reader.ReadSingle();
			ObjectInfoAssist.LoadChild(_reader, _version, this.child, _import);
		}

		// Token: 0x06001DAC RID: 7596 RVA: 0x000BC344 File Offset: 0x000BA544
		public override void DeleteKey()
		{
			Studio.DeleteIndex(base.dicKey);
			foreach (ObjectInfo objectInfo in this.child)
			{
				objectInfo.DeleteKey();
			}
		}

		// Token: 0x04002031 RID: 8241
		public float animeSpeed = 1f;

		// Token: 0x04002032 RID: 8242
		public HSColorSet color = new HSColorSet();

		// Token: 0x04002033 RID: 8243
		public HSColorSet color2 = new HSColorSet();

		// Token: 0x04002034 RID: 8244
		public bool enableFK;

		// Token: 0x04002035 RID: 8245
		public Dictionary<string, OIBoneInfo> bones;

		// Token: 0x04002036 RID: 8246
		public float animeNormalizedTime;
	}
}
